package com.aikon.wht.guava;

import java.util.List;
import java.util.Map;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * 
 * @author haitao.wang
 *
 */
public class asdf {

	private static final Map<String, String> SELLINGPOINTSMAP = Maps.newHashMap();

	static {
		SELLINGPOINTSMAP.put("总价低", "低总价");
		SELLINGPOINTSMAP.put("不限购", "不限购");
		SELLINGPOINTSMAP.put("性价比高", "性价比高");
		SELLINGPOINTSMAP.put("投资回报高", "投资地产");
		SELLINGPOINTSMAP.put("交通便利", "交通");
		SELLINGPOINTSMAP.put("地铁沿线", "号线双规交房");
		SELLINGPOINTSMAP.put("地铁上盖", "地铁上盖");
		SELLINGPOINTSMAP.put("品牌开发商", "品牌开发商");
		SELLINGPOINTSMAP.put("金牌物业", "金牌物业");
		SELLINGPOINTSMAP.put("配套完善", "医院银行商场菜市场");
		SELLINGPOINTSMAP.put("沿街旺铺", "沿街旺铺商铺");
		SELLINGPOINTSMAP.put("小户型", "小户型");
		SELLINGPOINTSMAP.put("大平层", "大平层");
		SELLINGPOINTSMAP.put("定制精装修", "精装修");
		SELLINGPOINTSMAP.put("绿化率高", "高绿化");
		SELLINGPOINTSMAP.put("现房", "现房");
		SELLINGPOINTSMAP.put("准现房", "准现房");
		SELLINGPOINTSMAP.put("学区房", "学区房学校");
		SELLINGPOINTSMAP.put("景观住宅", "观景小区、景观小区");
		SELLINGPOINTSMAP.put("科技住宅", "科技住宅");
		SELLINGPOINTSMAP.put("江景单位", "江");
		SELLINGPOINTSMAP.put("湖景住宅", "湖");
		SELLINGPOINTSMAP.put("高端社区", "豪宅");
		SELLINGPOINTSMAP.put("酒店式公寓", "单身公寓酒店式公寓");
		SELLINGPOINTSMAP.put("精装loft", "loft");
		SELLINGPOINTSMAP.put("附赠面积大", "附赠面积大");
		SELLINGPOINTSMAP.put("低密度", "低密度");
		SELLINGPOINTSMAP.put("临近公园", "公园");
	}

	public static List<String> convert(final List<String> srcLsit) {
		List<String> destList = Lists.newArrayList();
		if (destList == null) {
			return destList;
		}

		destList = Lists.transform(srcLsit, new Function<String, String>() {

			private Predicate<String> predicate;

			@Override
			public String apply(final String input) {

				Map<String, String> filterdMap = Maps.newHashMap();

				predicate = new Predicate<String>() {

					@Override
					public boolean apply(String sth) {
						if (sth.contains(input)) {
							return true;
						}
						return false;
					}
				};

				filterdMap = Maps.filterValues(SELLINGPOINTSMAP, predicate);

				if (filterdMap.keySet() == null || filterdMap.keySet().isEmpty()) {
					return "";
				}

				return (String) filterdMap.keySet().toArray()[0];
			}
		});

		return destList;

	}
	
	

}
